package Doan;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Label;
import java.awt.SystemColor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.io.PrintStream;
import java.net.Socket;

import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JSplitPane;
import javax.swing.JTextField;
import javax.swing.border.Border;
public class Client extends JPanel implements ActionListener {
	// <---------------------------------------------------------------------------------------------------------------->
	// khai bao cac bien ket noi server

	Socket sock;
	BufferedInputStream bis;
	DataInputStream in;
	PrintStream out;

	// khai bao cac bien dung toan cuc

	String nowAcc;// so tai khoan cua nguoi dang nhap
	String nowPass;// mat khau cua nguoi dang nhap
	String name; // chua ten nguoi dang nhap
	Integer tien; // chua tien nguoi dang nhap
	public static JSplitPane twoPane;

	// <----------------------------------------->
	// phan cac dieu khien cua cac panel

	// panel chon ngon ngu

	JButton tiengviet = new JButton("Vietnamese", new ImageIcon("Data/vn.png"));
	JButton english = new JButton("English", new ImageIcon("Data/english.jpg"));
	JButton disconnect = new JButton("Thoát",new ImageIcon("Data/1.png"));

	// panel login

	private JTextField txtAccountNo = new JTextField(12);
	private JPasswordField txtPassword = new JPasswordField(12);
	JLabel loggin = new JLabel("");
	JLabel account = new JLabel("");
	JLabel pin = new JLabel("");
	JLabel hd = new JLabel("");
	JButton btxoa = new JButton("");
	JButton btexit = new JButton("");
	JButton btenter = new JButton("");

	// panel chinh

	JButton RutTien = new JButton("",new ImageIcon("Data/money.png"));// Rut Tien
	JButton NapTien = new JButton("",new ImageIcon("Data/naptien.jpg"));// nap tien
	JButton SoDu = new JButton("",new ImageIcon("Data/check.jpg"));// Xem So Du
	JButton ChangePIN = new JButton("",new ImageIcon("Data/change.jpg"));// Doi PIN
	JButton ChuyenKhoan = new JButton("",new ImageIcon("Data/chuyenkhoan.jpg"));// Chuyen Khoan
	JButton KetThuc = new JButton("", new ImageIcon("Data/fn.jpg"));// Ket
																		// Thuc
	JLabel LName = new JLabel("", JLabel.CENTER);
	JLabel LSodu = new JLabel("");

	// panel rut tien

	JButton Mottram = new JButton("100.000 VND");
	
	JButton Haitram = new JButton("200.000 VND");
	JButton Namtram = new JButton("500.000 VND");
	JButton Mottrieu = new JButton("1.000.000 VND");
	JButton Sokhac = new JButton("", new ImageIcon("Data/sokhac.jpg"));// So khac
	JButton Huy = new JButton("", new ImageIcon("Data/huy.png"));// Huy giao dich rut tien
	JLabel LName2 = new JLabel("", JLabel.CENTER);

	// panel nap tien

	JButton napMottram = new JButton("100.000 VND");
	JButton napHaitram = new JButton("200.000 VND");
	JButton napNamtram = new JButton("500.000 VND");
	JButton napMottrieu = new JButton("1.000.000 VND");
	JButton napSokhac = new JButton("", new ImageIcon("Data/sokhac.jpg"));// So khac
	JButton Huynap = new JButton("", new ImageIcon("Data/huy.png"));// Huy giao dich nap tien
	JButton Returnnap = new JButton("", new ImageIcon("Data/exit.gif"));
	JLabel LName2nap = new JLabel("", JLabel.CENTER);

	// panel rut tien so khac

	JLabel LName3 = new JLabel("", JLabel.CENTER);
	JTextField txtSotien = new JTextField(20);
	JButton Rut = new JButton("",new ImageIcon("Data/thuchien.png"));// Rut
	JButton Huy2 = new JButton("",new ImageIcon("Data/1.png"));// Huy giao dich rut tien so khac
	JLabel dieukien = new JLabel("");
	JLabel tbruttien = new JLabel("");

	// panel nap tien so khac

	JLabel LName3nap = new JLabel("", JLabel.CENTER);
	JTextField txtSotiennap = new JTextField(20);
	JButton Nap = new JButton("",new ImageIcon("Data/thuchien.png"));// Rut
	JButton Huy2nap = new JButton("",new ImageIcon("Data/1.png"));// Huy giao dich nap tien so khac
	JLabel dieukiennap = new JLabel("");
	JLabel tbnaptien = new JLabel("");

	// panel Chuyen Khoan

	JTextField Sotkhoan = new JTextField(12);
	JTextField Stien = new JTextField(12);
	JButton Thuchien = new JButton("",new ImageIcon("Data/thuchien.png"));// Thuc hien
	JButton Huy1 = new JButton("",new ImageIcon("Data/1.png"));// Huy giao dich
	JLabel label = new JLabel("");
	JLabel tknhan = new JLabel("");
	JLabel sotien = new JLabel("");

	// panel thong bao rut tien

	JLabel l1 = new JLabel("", JLabel.RIGHT);
	JLabel l2 = new JLabel("", JLabel.RIGHT);
	JLabel l3 = new JLabel("", JLabel.RIGHT);
	JLabel l4 = new JLabel("", JLabel.RIGHT);
	JLabel thongbao = new JLabel("");
	JLabel taikhoan = new JLabel("");
	JLabel strut = new JLabel("");
	JLabel sdutte = new JLabel("");
	JLabel sduchophep = new JLabel("");
	JLabel Hoi = new JLabel("");
	JButton Co = new JButton("");
	JButton Khong = new JButton("");

	// panel thong bao nap tien

	JLabel l1nap = new JLabel("", JLabel.RIGHT);
	JLabel l2nap = new JLabel("", JLabel.RIGHT);
	JLabel l3nap = new JLabel("", JLabel.RIGHT);
	JLabel l4nap = new JLabel("", JLabel.RIGHT);
	JLabel thongbaonap = new JLabel("");
	JLabel taikhoannap = new JLabel("");
	JLabel stnap = new JLabel("");
	JLabel sduttenap = new JLabel("");
	JLabel sduchophepnap = new JLabel("");
	JLabel Hoinap = new JLabel("");
	JButton Conap = new JButton("");
	JButton Khongnap = new JButton("");

	// panel thong bao chuyen khoan

	JLabel l5 = new JLabel("", JLabel.RIGHT);
	JLabel l6 = new JLabel("", JLabel.RIGHT);
	JLabel l7 = new JLabel("", JLabel.RIGHT);
	JLabel l8 = new JLabel("", JLabel.RIGHT);
	JLabel l9 = new JLabel("", JLabel.RIGHT);
	JLabel thongbao1 = new JLabel("");
	JLabel taikhoan2 = new JLabel("");
	JLabel taikhoan1 = new JLabel("");
	JLabel strut1 = new JLabel("");
	JLabel sdutte1 = new JLabel("");
	JLabel sduchophep1 = new JLabel("");
	JLabel Hoi1 = new JLabel("");
	JButton Co1 = new JButton("");
	JButton Khong1 = new JButton("");

	// panel change PIN

	JPasswordField curPin = new JPasswordField(20);
	JPasswordField NewPin = new JPasswordField(20);
	JPasswordField confirmPin = new JPasswordField(20);
	JButton ChangeP = new JButton("", new ImageIcon("Data/4.jpg"));// Change
	JButton Quaylai = new JButton("", new ImageIcon("Data/quaylai1.png"));// Quay
																		// lai
	JLabel tbdoipin = new JLabel("");
	JLabel pincu = new JLabel("");
	JLabel pinmoi = new JLabel("");
	JLabel xacnhan = new JLabel("");

	// cac loi va cac thong bao

	String loi1, loi2, loi3, loi4, loi5, loi6, loi7, loi8, loi14, loi22, loi25,
			loi23, loi0, thoat;
	String stconlai;

	// <--------------------------->
	// tao cac panel

	JPanel Plog = login();
	JPanel Pmain = Chinh();
	JPanel PRut = Rut();
	JPanel pnap = Nap();
	JPanel PThongbao = ThongBao();
	JPanel PThongbao1 = ThongBao1();
	JPanel pThongbaonap = ThongBaoNap();
	JPanel PSokhac = SoKhac();
	JPanel pSokhacnap = SoKhacNap();
	JPanel Ppin = doipin();
	JPanel PChuyenkhoan = Chuyenkhoan();